Adding vmId as part of error response when vm create fails.#8484
Conversation
|
@blueorangutan package |
|
@anniejili a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8259 |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #8484 +/- ##
============================================
- Coverage 30.90% 30.78% -0.12%
+ Complexity 34142 34014 -128
============================================
Files 5353 5353
Lines 375900 375935 +35
Branches 54629 54633 +4
============================================
- Hits 116158 115749 -409
- Misses 244428 244975 +547
+ Partials 15314 15211 -103
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
DaanHoogland
left a comment
There was a problem hiding this comment.
@anniejili , it makes function sense what you are trying to do. I have some requests though.
- can you make methods for the new code, especially try to avoid having nested try-catch blocks in a single method?
- as @harikrishna-patnala requested, please remove commented code? We have source control and can always get the code back if we need to.
- you submitted and closed another PR for a similar attempt. There is no reason to open a new one, you can push --force to the same branch to update the PR with your new method of implementation. This will aid in keeping track of discussions on the subject.
That all said, thanks you for you effort and welcome ;) . once again it makes total sense and also seems to do what you suggested on the PR description.
|
@anniejili , please have a look at https://github.com/apache/cloudstack/actions/runs/7467774820/job/20329156779?pr=8484#step:6:9822 (some line endings were disapproved of by the robots ruling our lives) |
|
Ack. |
|
@blueorangutan package |
|
@anniejili a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
@DaanHoogland Hi Dahn, Thank you for reviewing my code. As far as I can tell, there is no nested try-catch introduced by this change. Can you please double check?
Done. Thank you @harikrishna-patnala!
My bad, will make sure it won't happen next time.
|
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8279 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
You are right,I cannot see that nesting of try-catch blocks anymore, maybe I was confusing different PRs. The request remains however; can you make methods for the new code? for readability sake, verbs and nouns are easier to read (given proper method naming) than curls and braces. Also this commitUserVm method is now 150 lines long (not your fault) so let's reduce that a bit. In no way is this a deprecation of your code, just a suggestion for improvement. (not a 👎 !!) |
Co-authored-by: dahn <daan.hoogland@gmail.com>
|
@blueorangutan package |
|
@anniejili a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
@anniejili , I accidenntly updated your PR. Hope you don't mind. |
No worries. |
|
@DaanHoogland Does the PR look okay now? Thank you! |
code looks good @anniejili , but I would still request that you extract the new code into a new method with a clear name. |
It is moved to a new method line #4582. |
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, thanks @anniejili
|
Conflicts resolving, re kicking packaging for a final check @blueorangutan package |
|
@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8564 |
|
Thanks @weizhouapache I've addressed some of the cosmetics changes, cc @anniejili |
|
@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8570 |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-9117)
|
) * Adding vmId as part of error response when vm create fails. * Removed unneeded comments. * Fixed code review comments. * Update server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java Co-authored-by: dahn <daan.hoogland@gmail.com> * Fixed code review comments. * Update server/src/main/java/com/cloud/vm/UserVmManagerImpl.java * Update server/src/main/java/com/cloud/vm/UserVmManagerImpl.java * Update server/src/main/java/com/cloud/vm/UserVmManagerImpl.java * Update server/src/main/java/com/cloud/vm/UserVmManagerImpl.java --------- Co-authored-by: Annie Li <ji_li@apple.com> Co-authored-by: dahn <daan.hoogland@gmail.com> Co-authored-by: dahn <daan@onecht.net> Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: Rohit Yadav <rohityadav89@gmail.com>
Description
This PR fixes the difficulty in cleaning up failed VM resources.
If there is a failure during VM create after vm entity is persisted, Vm UUID will be included as part of the error response.
{
"deployvirtualmachineresponse": {
"uuidList": [
{
"serialVersionUID": -7514266713085362000,
"uuid": "f1a9a209-20a8-42ce-8f5c-457f2f560e95",
"description": "vmId"
}
],
"errorcode": 530,
"cserrorcode": 4250,
"errortext": “Error text”
}
}
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
DeployVm API response without fix:
{
"deployvirtualmachineresponse": {
"uuidList": [],
"errorcode": 530,
"cserrorcode": 4250,
"errortext": “Error text”
}
}
After Fix:
{
"deployvirtualmachineresponse": {
"uuidList": [
{
"serialVersionUID": -7514266713085362000,
"uuid": "f1a9a209-20a8-42ce-8f5c-457f2f560e95",
"description": "vmId"
}
],
"errorcode": 530,
"cserrorcode": 4250,
"errortext": “Error text”
}
}
How Has This Been Tested?
Change was tested in my own development environment.